home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / AlphaSpell / guess.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-26  |  2KB  |  44 lines

  1. /**************************************************************************/
  2. /* $VER: Guess.rexx 1.0 (29 Aug 1995)                                     */
  3. /**************************************************************************
  4.  
  5. This ARexx script uses AlphaSpell to guess at a word. If a wildcard pattern
  6. is passed, it does pattern matching on the dictionaries. Otherwise, it uses
  7. one of AlphaSpell's guessing routines. If an edit distance is passed as its
  8. second argument, it guesses by measuring edit distances. Otherwise, it uses
  9. a SoundEx method. This script is designed to be adapted for use with a text
  10. editor. To adapt it, change the "SAY" command at the end to a statement for
  11. inserting the word into the text of a document.
  12.  
  13. **************************************************************************/
  14.  
  15. IF EXISTS("libs:rexxarplib.library") THEN DO
  16.     IF ~SHOW("L","rexxarplib.library") THEN
  17.         CALL ADDLIB("rexxarplib.library",0,-30)
  18. END
  19. ELSE SAY "You need RexxArpLib.library"
  20.  
  21. PARSE ARG word k
  22. k = strip(k)
  23.  
  24. IF VERIFY(word, "?*\[]!^", "Match") ~= 0 THEN
  25.     com = "AlphaSpell -Po T:List -d" GetENV("DDIR") "-w" word GetENV("Dict")
  26. ELSE IF DATATYPE(k) = "NUM" THEN
  27.     com = "AlphaSpell -Go T:List -n" k "-d" GetENV("DDIR") "-w" word GetENV("Dict")
  28. ELSE
  29.     com = "AlphaSpell -Go T:List -d" GetENV("DDIR") "-w" word GetENV("Dict")
  30. ADDRESS COMMAND com
  31.  
  32. CALL Open(input,"T:List","R")
  33. n = 0
  34. DO UNTIL EOF(input)
  35.     n = n + 1
  36.     list.n = Readln(input)
  37. END
  38. CALL Close(input)
  39.  
  40. word = RequestList(1, n - 1, list, 100, 50, 300, 150,,"SORT")
  41. SAY word
  42.  
  43. EXIT
  44.